package com.tanhua.server.controller;

import com.tanhua.model.vo.PeachbossomVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    //接受语音
    @GetMapping
    public ResponseEntity peachblossomjs(){
        PeachbossomVo vo = peachblossomService.peachblossomjs();
        return ResponseEntity.ok(vo);
    }

    //发送语言
    @PostMapping
    public ResponseEntity peachblossom(MultipartFile soundFile, HttpServletResponse response) throws IOException {
        peachblossomService.peachblossomfs(soundFile,response);
        return ResponseEntity.ok(null);
    }
}
